<template>
    <div>
        <Modal :title="rightsAdjustTitle" v-model="rightsAdjustModal" :mask-closable='false' :width="480" :styles="{top: '90'}">
            <div class="modal-body">
                <Form :model="formItem" :label-width="90">
                    <FormItem label="允许修改日历" style="margin-top: -40px;margin-left: 80px;">
                        <RadioGroup v-model="formItem.calendar">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许离岗" style="margin-top: -20px;margin-left: 80px">
                        <RadioGroup v-model="formItem.post">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许上岗" style="margin-top: -20px;margin-left: 80px">
                        <RadioGroup v-model="formItem.duties">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许置顶/取消置顶" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.top">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许锁定/取消锁定" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.locking">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许案件撤回" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.case">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许修改流程" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.procedure">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许标签/删除标签" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.pag">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许影像后补" :label-width="150" style="margin-top: -20px;margin-left: 20px">
                        <RadioGroup v-model="formItem.image">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem label="是否允许查看信贷报告及录音" :label-width="170" style="margin-top: -20px">
                        <RadioGroup v-model="formItem.query">
                            <Radio label="allow">允许</Radio>
                            <Radio label="prohibit">不允许</Radio>
                        </RadioGroup>
                    </FormItem>
                </Form>
            </div>
            <div slot="footer">
                <Button type="text" @click="cancelUser">取消</Button>
                <Button type="primary" :loading="submitLoading" @click="submitUser">提交</Button>
            </div>
        </Modal>
    </div>
</template>
<script>
    import {powerUpdate,queryPower} from "@/projects/afs-core-business/api/afs-case/parameter-rules/group";
    export default {
        name: "rightsAdjust",
        data(){
            return{
                rightsAdjustTitle:"权限调整",
                rightsAdjustModal:false,
                submitLoading:false,
                memberInfo:{
                    userId:"",
                    groupId:"",
                    param:{},
                    loginName:"",
                },
                formItem: {}
            }
        },
        methods:{
            rightsAdjustMsg: function (msg) {
                if(msg!==""){
                    this.memberInfo.loginName = msg[0].loginName;
                    this.memberInfo.groupId = msg[0].groupId;
                    this.rightsAdjustModal = true;
                    this.queryPowerInfo();
                }
            },
            cancelUser(){
                this.rightsAdjustModal = false;
            },
            submitUser(){
                this.memberInfo.param = this.formItem;
                powerUpdate(this.memberInfo).then(res => {
                    if(res.code === "0000"){
                        this.$Message.success("保存成功");
                        this.rightsAdjustModal = false;
                        this.$parent.refreshMember();
                    }
                })
            },
            queryPowerInfo(){
                queryPower(this.memberInfo).then(res=>{
                    if(res.code === "0000"){
                        this.formItem = res.data.param;
                    }
                })
            }
        },
    }
</script>
<style>
    .modal-body {
        padding: 20px;
        margin-left: 20px;
        height: 330px;
    }
</style>
